<template>
  <div class="store">
    <div class="el-row" style="margin: 0 10px">
      <!-- 左侧店铺信息 -->
      <div class="el-col-4">
        <div class="store-navigation">
          <div class="store-summary">
            <div class="store-summary-heading">
              <a href="/">
                <img class="heading-img" src="@/assets/image/电商商标.jpg" :alt="storeinfos.name" >
              </a>
              <h5>
                <a href="/store/1728">{{ storeinfos.name }}</a>
                <span class="heading-label">自营</span>
              </h5>
            </div>
            <div class="store-summary-body" >
              <dl class="body-horizontal">
                <dt>地址:</dt>
                <dd>{{storeinfos.address}}</dd>
              </dl>
              <p style="margin: 0">
                <a href="#" :tit1e="storeinfos.email">
                  <img src="@/assets/image/qq.png" class="qq-img" :alt="storeinfos.email">
                </a>
                <a href="#" :title="storeinfos.mobile">
                  <img src="@/assets/image/qq.png" class="qq-img" :alt="storeinfos.mobile">
                </a>
              </p>
            </div>
            <div class=" store-summary-footer">
              <router-link class="footer-btn" to="/store">进店逛逛</router-link>
              <a class="footer-btn btn-right" href="#">店铺收藏</a>
            </div>
          </div>
          <form class="search-input" action="/product/search" method="get" >
            <div class="input-group">
              <input name="keyword" class="input-control" type="text" placeholder="搜索" />
              <div class="input-group-btn">
                <button class="input-btn" type="submit">
                  <i class="iconfont el-icon-search"></i>
                </button>
              </div>
            </div>
          </form>
          <RankingList style="width: 100%;"></RankingList>
        </div>
      </div>
      <!-- 内容 -->
      <div class="el-col-20">
        <!-- 轮播图 -->
        <div class="block">
          <el-carousel>
            <el-carousel-item>
              <img style="width: 100%;" src='https://shop.xiaoxiangai.com/upload/image/202101/732b9344-105f-447d-80d7-7554f2485798.jpg'>
            </el-carousel-item>
            <el-carousel-item style="width:1108px">
              <img style="width: 100%;" src='https://shop.xiaoxiangai.com/upload/image/202101/9e31449e-43dc-436e-ab4b-3f0119078ca1.jpg'>
            </el-carousel-item>
          </el-carousel>
        </div>
        <!-- 商品 -->
        <div class="product">
          <div class="product-heading">
            <h5 class="heading-text">商品信息</h5>
          </div>
          <div>
            <storeGoods :goods="allproduct"></storeGoods>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import RankingList from "@/components/RankingList";
  import storeGoods from "@/components/storeGoods";
  import {storeinfo} from '@/api/storemodule'
  import {product} from '@/api/storemodule'
  import {ref} from "vue";

  export default {
    name: "store",
    components: {storeGoods, RankingList},
    props:['storeId'],
    setup(props){
      let storeinfos = ref({})
      let allproduct = ref({})
      let storeid = ref(props.storeId)
      if(props.storeId == undefined){
        storeid.value = sessionStorage.getItem('store')
      }
      function getproduct(){//查询店铺商品
        product(storeid.value).then(res =>{
          allproduct.value = res.data.data
          console.log('getproduct',allproduct.value)
        })
      }
      function getstoreinfo(){//查询店铺信息
        storeinfo(storeid.value).then(res =>{
          storeinfos.value = res.data.data
          // console.log('getstoreinfo',storeinfos.value)
        })
      }
      getproduct()
      getstoreinfo()
      return{
        storeinfos,
        allproduct,
      }
    },
  }
</script>

<style scoped>
  *{
    color: #333;
    font-size: 13px;
  }
  a{
    text-decoration: none;
  }
  ul,li,dd,dt{
    text-decoration: none;
  }
  .store{
    width: 1350px;
    margin: 17px auto;
  }
  /* 左侧店铺信息 */
  .store-navigation{
    background-color: white;
    margin-right: 15px;
  }
  .store-summary{
    padding: 0 10px;
    margin-bottom: 15px;
    transition: box-shadow 0.3s;
    border: 1px #eeeeee solid;
  }

  .store-summary-heading{
    padding: 10px 0;
    border-bottom: 1px #eeeeee solid;
  }
  .heading-img{
    display: block;
    max-width: 100%;
    height: auto;
    margin: auto auto;
  }
  .store-summary-heading h5{
    line-height: 30px;
    text-align: center;
  }
  .store-summary-heading h5 a{
    color: #5762fe;
  }
  .heading-label{
    color: white;
    font-weight: bold;
    background-color: #409EFF;
    text-align: center;
    padding: 1px 6px 2px;
    margin-left: 5px;
    border-radius: 2px;
  }

  .store-summary-body{
    padding-top: 10px;
  }
  .body-horizontal{
    margin-bottom: 10px;
  }
  .body-horizontal dt{
    width: 50px;
    line-height: 20px;
    color: #999999;
    font-weight: normal;
    text-align: left;
  }
  .body-horizontal dd{
    line-height: 20px;
    margin-left: 50px;
    margin-top: -20px;
    color: #888888;
  }
  .qq-img{
    margin-right: 10px;
    margin-bottom: 10px;
    transition: opacity 0.3s;
  }
  .qq-img:hover{
    opacity: 0.8;
  }

  .store-summary-footer{
    padding: 20px 0;
    border-top: 1px solid #eeeeee;
  }
  .footer-btn{
    color: #666666;;
    padding: 6px 12px;
    background-color: white;
    border: 1px #d8d8d8 solid;
    border-radius: 4px;
    transition: all 0.3s;
  }
  .footer-btn:hover{
    color: #409EFF;
    border-color: #409EFF;
  }
  .btn-right{
    margin-left: 27px;
  }

  .search-input{
    height: 100%;
    margin-bottom: 15px;
  }
  .input-group{
    position: relative;
    display: table;
    width: 100%;
    margin: 0 10px;
  }
  .input-control{
    display: table-cell;
    height: 31px;
    padding: 6px 12px;
    font-size: 12px;
    background-color: white;
    z-index: 2;
    border: 1px #d8d8d8 solid;
    border-radius: 4px;
  }
  .input-control:hover{
    box-shadow: 0 2px 12px 0 rgba(64, 158, 255, 0.1);
    border-color: #49a9ee;
  }
  .input-group-btn{
    display: table-cell;
    white-space: nowrap;
    vertical-align: middle;
    z-index: 2;
  }
  .input-btn{
    padding: 6px 12px;
    font-size: 12px;
    margin-left: -60px;
    background-color: white;
    overflow: visible;
    transition: all 0.3s;
    border: 1px #d8d8d8 solid;
    border-radius: 4px;
  }
  .input-btn:hover{
    color: #409eff;
    border-color: #409EFF;
  }
  .iconfont{
    font-size: 12px;
  }
  /*内容*/
  .product{
    width: 100%;
    margin-top: 17px;
  }
  .product-heading{
/*    margin-bottom: 15px;*/
    border-bottom: 1px solid #eeeeee;
  }
  .heading-text{
    line-height: 25px;
    display: inline-block;
    margin-bottom: -1px;
    border-bottom: 2px #49a9ee solid;
  }
</style>